/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */

package theserver;

import java.io.Serializable;
import java.sql.Timestamp;


/**
 * @author Emma
 */
public class DeviceInfo implements Serializable {

	/**
	 * 
	 */
	private static final long	serialVersionUID	= -2160581533489511672L;
	private String				bssid;
	private final String		owner;
	private String				ssid;
	private final String		deviceID;
	private String				ipAddress;
	private int					port;
	private Timestamp			lastSeen;
	private int					location;


	public DeviceInfo(String deviceID, String owner) {
		this.owner = owner;
		this.deviceID = deviceID;
	}


	/**
	 * @return the bssid
	 */
	public String getBssid() {
		return bssid;
	}


	public void setBssid(String bssid) {
		this.bssid = bssid;
	}


	/**
	 * @return the name
	 */
	public String getOwner() {
		return owner;
	}


	/**
	 * @return the ssid
	 */
	public String getSsid() {
		return ssid;
	}


	/**
	 * @param ipAddress the ipAddress to set
	 */
	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}


	/**
	 * @param port the port to set
	 */
	public void setPort(int port) {
		this.port = port;
	}


	/**
	 * @param ssid the ssid to set
	 */
	public void setSsid(String ssid) {
		this.ssid = ssid;
	}


	/**
	 * @return the androidID
	 */
	public String getDeviceID() {
		return deviceID;
	}


	/**
	 * @return the ipAddress
	 */
	public String getIpAddress() {
		return ipAddress;
	}


	/**
	 * @return the port
	 */
	public int getPort() {
		return port;
	}


	/**
	 * @return the lastSeen
	 */
	public Timestamp getLastSeen() {
		return lastSeen;
	}


	/**
	 * @param lastSeen the lastSeen to set
	 */
	public void setLastSeen(Timestamp lastSeen) {
		this.lastSeen = lastSeen;
	}


	/**
	 * @return the location
	 */
	public int getLocation() {
		return location;
	}


	/**
	 * @param location the location to set
	 */
	public void setLocation(int location) {
		this.location = location;
	}


	@Override
	public String toString() {
		String s = owner+": "+deviceID;
				
		return s;
	}


	@Override
	public boolean equals(Object o) {
		if (o instanceof DeviceInfo) {
			return (((DeviceInfo) o).getDeviceID().equals(deviceID));
		}
		return (false);
	}


	@Override
	public int hashCode() {
		int hash = 7;
		hash = 17 * hash
				+ (this.deviceID != null ? this.deviceID.hashCode() : 0);
		return hash;
	}
}
